package com.topscore.uke.mvp.presenters;

import android.os.UserManager;

import com.topscore.uke.mvp.contractors.GetMemberCountContractor;
import com.topscore.uke.mvp.model.GetMemberCountModel;
import com.topscore.uke.network.BaseResponse;
import com.topscore.uke.utils.UserInfoManager;

/**
 * Created by 71468 on 2018/3/22.
 */

public class GetMemberCountPresenter implements GetMemberCountContractor,GetMemberCountContractor.Presenter {
    private View mView;
    private Model model;

    public GetMemberCountPresenter(View view) {
        this.mView = view;
        this.model = new GetMemberCountModel(new CallBack() {
            @Override
            public void onSuccess(BaseResponse<Integer> response) {
                mView.onGetCountSuccess(response.getData());
            }

            @Override
            public void onError(int errorCode, String errorMessage) {
                mView.onFail(errorCode,errorMessage);
            }

            @Override
            public void onComplete() {

            }
        });
    }

    @Override
    public void getMemberCount() {
        String role = UserInfoManager.getUserInfo().getRole();
        String loginName = UserInfoManager.getUserInfo().getLoginName();
        model.getCount(role,loginName);
    }
}
